/**
 * 6.1 原型链
 * 默认的继承模式：通过原型来实现继承关系链
 * 继承的作用：能使每个对象都能访问其继承链上的任何一个属性
 */
function Shape() {
    this.name = 'Shape';
    this.toString = function () {
        return this.name;
    };
}

function TwoDShape() {
    this.name = '2D shape';
}

function Triangle(side, height) {
    this.name = 'Triangle';
    this.side = side;
    this.height = height;
    this.getArea = function () {
        return this.side * this.height / 2;
    };
}